package util;

public class WineVarietal {
	private Varietal varietal;
	private String[] factors;
	
	public WineVarietal(Varietal varietal, String factors){
		this.varietal = varietal;
		this.factors = factors.split(",");
	}
	
	public VarietalRanking rank(String ingredientList){
		int rank = 0;
		for(String factor : factors){
			if(ingredientList.contains(factor)){
				rank++;
			}
		}
		return new VarietalRanking(varietal, rank);
	}
	
	public Varietal getVarietal(){
		return this.varietal;
	}
}
